Skip to content

fix(id): refuse duplicate after hashes in artifact check() (#3196) - #4318

Merged
dezren39 merged 2 commits into
mainfrom
queue/5661-3196-duplicate-after-check
Nov 2, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/5661-3196-duplicate-after-check

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #3196

Queue task: task 5661

Problem

SignedArtifact::check() (pkgs/id/src/artifact.rs) capped after at MAX_AFTER and required every entry to be a hash, but never checked uniqueness — the same hash repeated 32 times filled the whole frontier and verified + inserted as New. The sibling ChainExt::validate() (chain.rs) refuses the identical field with ChainError::DuplicateAfter.

Change

  • check() now runs a HashSet over after (mirroring chain.rs) and refuses on the first repeat, with the error naming the repeated hash: "an artifact names {hash} twice in after".
  • One fix point covers verify() and ArtifactLog::insert; locally signed artifacts with a repeated after hash are refused at the same gate on insert.

Tests

New test duplicate_after_hashes_are_refused in the artifact test module:

  • [h, h] refused by both verify() and insert()
  • same hash × MAX_AFTER (32) refused
  • 32 distinct hashes still verify and insert as Stored::New

Verification is GitHub Actions CI (id workflow) per the task packet — the laptop had no build window this shift (load ~100). rustfmt --check and git diff --check pass on the changed file.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 10:12
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6284f93-c23c-432b-b00e-5eccc5ca76c6
Commits

Reviewing files that changed from the base of the PR and between b8bbe73 and aed045e.

Files selected for processing: 1
  • pkgs/id/src/artifact.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T10:52:35.561767Z aed045e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a730f6c0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/id/src/artifact.rs Outdated
}

#[test]
fn duplicate_after_hashes_are_refused() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prefix the new test name with test_

The scoped naming guideline in pkgs/id/AGENTS.md explicitly requires tests to use the test_ prefix. Rename this new test to test_duplicate_after_hashes_are_refused to follow the package’s documented convention.

AGENTS.md reference: pkgs/id/AGENTS.md:L140-L140

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in aed045e: renamed the test to test_duplicate_after_hashes_are_refused, per the test_ prefix convention in pkgs/id/AGENTS.md (L140). One-line rename, no logic change. — repo-worker-code, queue task 5661

@dezren39

dezren39 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

Head aed045e renames the new test to test_duplicate_after_hashes_are_refused per your P1 on 7a730f6 (pkgs/id/AGENTS.md test_ prefix). Please re-review the new head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: aed045ea6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 merged commit bc1bdce into main Nov 2, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5661-3196-duplicate-after-check branch November 2, 2026 11:55
@dezren39
dezren39 restored the queue/5661-3196-duplicate-after-check branch November 8, 2026 04:19
@dezren39
dezren39 deleted the queue/5661-3196-duplicate-after-check branch November 9, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(artifact): check() accepts duplicate after hashes — the same hash can fill all 32 frontier slots, unlike chain.rs which refuses DuplicateAfter

1 participant